using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class GetObjectFromSession : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if(Session["cart"]!=null)
        {
            Literal1.Text ="Shopping cart<br>";
            DataTable dataTable = (DataTable)Session["cart"];
            foreach (DataRow dataRow in dataTable.Rows)
            {
                Literal1.Text +="ItemID: " 
                + dataRow[0].ToString() +"<br>";
                Literal1.Text += "ItemName: " +
                 dataRow[1].ToString() + "<br>";
                Literal1.Text += "ItemUnit: " 
                + dataRow[2].ToString() + "<br>";
                Literal1.Text += "ItemQuantity: " 
                + dataRow[3].ToString() + "<br>";
                Literal1.Text += "ItemPrice: " 
                + dataRow[4].ToString() + "<br><br>";
            }
        }
        else
            Response.Redirect("SessionWithObject.aspx");
    }
}
